module.exports = function(sequelize, DataTypes) {
    const ledgerResult = sequelize.define('ledgerResult', {
        id: {
            type: DataTypes.BIGINT(20).UNSIGNED,
            allowNull: false,
            autoIncrement: true,
            primaryKey: true,
            readonly: true
        },
        status: {
            type: DataTypes.ENUM,
            values: ['handling', 'solved', 'invalid','giveup'], //处理中,已处理,无效的
            defaultValue: 'handling'
        },
        organization_id: {
            type: DataTypes.BIGINT(20).UNSIGNED,
            allowNull: false,
        },
        file_name: {
            type: DataTypes.STRING
        }, //文件名称
        key: {
            type: DataTypes.STRING(191)
        }, //上传文件标识
        num: {
            type: DataTypes.BIGINT(10)
        }, //失败条数
        file_url: {
            type: DataTypes.STRING
        }, //未导入数据下载
        user: {
            type: DataTypes.BIGINT(20).UNSIGNED
        }, //上传者
        mark: {
            type: DataTypes.STRING
        } //备注
    }, {
        tableName: 'sophic_ledger_results',

        underscored: true,

        indexes: [{
            fields: ['key']
        }, {
            fields: ['organization_id']
        }],

        //scopes: {
        //    list: {
        //        attributes: ['id', 'nameZh', 'nameEn']
        //    },
        //    detail: {
        //        attributes: ['id', 'nameZh', 'nameEn', 'createdAt']
        //    }
        //},

        classMethods: {

            operationLog: true,

            associate: function(models) {}
        }
    });

    return ledgerResult;
};